<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link type="text/css" href="/css/start/jquery-ui-1.8.21.custom.css" rel="Stylesheet" />	
<style type="text/css">
/* <![CDATA[ */

table, td
{
    border-color: #666;
    border-style: solid;
}
table, th
{
    border-color: #666;
    border-style: solid;
}

table
{
    border-width: 0 0 1px 1px;
    border-spacing: 0;
    border-collapse: collapse;
}
 
td
{
    margin: 0;
    padding: 4px;
    border-width: 1px 1px 0 0;
}
th
{
    margin: 0;
    padding: 4px;
    border-width: 1px 1px 0 0;
}

/* ]]> */
</style>

<style type="text/css">
.noborder{
	border-top-width:0px;
	border-bottom-width:0px;
	
	}
.withborder{
	border-top-width:1px;
	border-bottom-width:0px;
	}	
#lean_overlay {
    position: fixed;
    z-index:100;
    top: 0px;
    left: 0px;
    height:100%;
    width:100%;
    background: #000;
    display: none;
} 

.btn_act{

    width: 600px;
    padding-bottom: 2px; 
	display:none;
	background: #FFF;
    border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px;
    box-shadow: 0px 0px 4px rgba(0,0,0,0.7); -webkit-box-shadow: 0 0 4px rgba(0,0,0,0.7); -moz-box-shadow: 0 0px 4px rgba(0,0,0,0.7);      
}
.btn_edit{

    width: 900px;
    padding-bottom: 2px; 
	display:none;
	background: #FFF;
    border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px;
    box-shadow: 0px 0px 4px rgba(0,0,0,0.7); -webkit-box-shadow: 0 0 4px rgba(0,0,0,0.7); -moz-box-shadow: 0 0px 4px rgba(0,0,0,0.7);      
}
.btn_com{

    width: 600px;
    padding-bottom: 2px; 
	display:none;
	background: #FFF;
    border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px;
    box-shadow: 0px 0px 4px rgba(0,0,0,0.7); -webkit-box-shadow: 0 0 4px rgba(0,0,0,0.7); -moz-box-shadow: 0 0px 4px rgba(0,0,0,0.7);      
}
.btn_delete{

    width: 600px;
    padding-bottom: 2px; 
	display:none;
	background: #FFF;
    border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px;
    box-shadow: 0px 0px 4px rgba(0,0,0,0.7); -webkit-box-shadow: 0 0 4px rgba(0,0,0,0.7); -moz-box-shadow: 0 0px 4px rgba(0,0,0,0.7);      
}
</style>


<script language="javascript"> 
function toggle(str,str2) {
	var ele = document.getElementById(str);
	var text = document.getElementById(str2);
	if(ele.style.display == "") {
    		ele.style.display = "none";
			text.innerHTML = "Show";
  	}
	else {
		ele.style.display = "";
		text.innerHTML = "Hide";
	}
} 
</script>
<script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="/js/jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript" src="/js/jquery.leanModal.min.js"></script>
<script type="text/javascript">
			$(function() {
    			$('a[rel*=leanModal]').leanModal({ top : 200, closeButton: ".modal_close" });		
			});
		</script>

<script>
	$(function() {
		$( "#date_will_pay" ).datepicker({ dateFormat: "yy-mm-dd",firstDay: 1 });
	});
</script>

</head>

<body style="font-family:Arial, Helvetica, sans-serif">
<h1>Account Payroll Case Control</h1><br/>
<hr width=100% size=1></hr>
<?php //var_dump($this->openCase);

$ts = new Model_DbTable_Roster_Timesheet();
$attd = new Model_DbTable_Roster_Attnrecord();
$attCaseRecord = new Model_DbTable_Roster_Attcaserecord();

$stDetail = new Model_DbTable_Roster_Stafflogindetail();



?>
<h2>Opening Case</h2>
Calculator:<br />
<br />
<b><i>From :</i></b>
<input name="cald_start_hour" type="text" id="cald_start_hour" style="width:50px" /><b>:</b><input name="cald_start_min" type="text" id="cald_start_min" style="width:50px" />
<b><i>To</i></b>
<input name="cald_end_hour" type="text" id="cald_end_hour" style="width:50px;" /><b>:</b><input name="cald_end_min" type="text" id="cald_end_min" style="width:50px;" /><b> = </b><input name="calh_total_hour" type="text" id="calh_total_hour" style="width:50px;" />
<i>(hrs)</i> <b> + </b>  
<input name="calh_hour_2" type="text" id="calh_hour_2" style="width:50px;" />
<i>(hrs)</i>  <b> = </b>
 <input name="calh_hour_sum" type="text" id="calh_hour_sum" style="width:50px;" />
<i>(hrs)</i>
 <br />
 <br />

<table width="1500" border="1" cellspacing="1" cellpadding="0" style="font-size:13px;">
  <tr>
    <th rowspan="2" scope="col">Case ID</th>
    <th rowspan="2" scope="col">Shop</th>
    <th rowspan="2" scope="col">Manager</th>
    <th rowspan="2" scope="col">Staff</th>
    <th rowspan="2" scope="col">Date</th>
    <th colspan="3" rowspan="2" scope="col">Shift</th>
    <th colspan="2" rowspan="2" scope="col">Actual Record</th>
    <th rowspan="2" scope="col">Bk</th>
    <th rowspan="2" scope="col">Problem</th>
    <th rowspan="2" scope="col">Allocate Hrs</th>
    <th rowspan="2" scope="col">Paid Hrs</th>
    <th rowspan="2" scope="col">Short Hrs</th>
    <th colspan="2" scope="col">Evidence</th>
    <th colspan="3" scope="col">Status</th>
    <th rowspan="2" scope="col">Detail</th>
    <th rowspan="2" scope="col" style="width:150px;">Action</th>
  </tr>
  <tr>
    <th scope="col">On Duty</th>
    <th scope="col">Off Duty</th>
    <th scope="col">Create</th>
    <th scope="col">Request</th>
    <th scope="col">Provided</th>
  </tr>
  
<?php 
if(!empty($this->openCase)){
foreach($this->openCase as $k => $v) {
	
	date_default_timezone_set("Australia/Melbourne");
	
	if($v['shop_code']=="ADPC" || $v['shop_code']=="CLPC" || $v['shop_code']=="CLIC" || $v['shop_code']=="WLIC"){

		date_default_timezone_set("Australia/Adelaide");
	}
	
	$sysShiftStart = " - ";
	$sysShiftEnd = " - ";
	$attOnDuty = " - ";
	$attOffDuty = " - ";
	
	//check case self case  or 
	//if(substr($v['case_id_case'],0,2) == "CA"){
if(1){
		$tsRow = $ts->listShiftByStaffIdByDateByShop($v['id_staff'], $v['shop_code'],$v['shift_date'],$v['shift_date']);
		$attRow = $attd->getFirstOnLastOffDuty($v['id_staff'],$v['shift_date'],Model_EncryptHelper::sslPassword($v['shop_code']));
		
		//var_dump($tsRow,$attRow);
	}	
	?>  
  <tr>
    <td rowspan="2"><?php echo $v['case_id_case']?></td>
    <td rowspan="2"><?php echo $v['shop_code']?></td>
    <td rowspan="2"><?php 
    $mgrDetail = $stDetail->getDetail($v['id_manager']);
    echo ($mgrDetail['ni']=="")?Model_EncryptHelper::getSslpassword($mgrDetail['n']):$mgrDetail['ni'];
    ?></td>
    <td rowspan="2"><?php 
    $mgrDetail = $stDetail->getDetail($v['id_staff']);
	echo ucwords(Model_EncryptHelper::getSslpassword($mgrDetail['n']));
	echo " <br />[";
	echo ucwords(($mgrDetail['ni']=="")?Model_EncryptHelper::getSslpassword($mgrDetail['n']):$mgrDetail['ni']);
	echo " ]";
    
    ?></td>
    <td rowspan="2"><?php echo $v['shift_date']?></td>
    <td>SYS:</td>
    <td><?php echo date("H:i",$tsRow['confirm_shift_begin']) ?></td>
    <td><?php echo date("H:i",$tsRow['confirm_shift_end']) ?></td>
    <td><?php echo ($attRow[0])?date("H:i",$attRow[0]):' X ' ?></td>
    <td><?php echo ($attRow[1])?date("H:i",$attRow[1]):' X ' ?></td>
    <td>
    F:<?php echo (int)$tsRow['break_time']/60; ?>
    S:<?php echo ($v['hour_request']>=9.5)?'30':'0'; ?>
    </td>
    <td rowspan="2">
    <?php 
    
    // 1. WRONG SHIFT 
    if( (int) date("H",$tsRow['confirm_shift_begin'])!= (int)$v['man_shift_begin_hour'] ||
    	(int) date("i",$tsRow['confirm_shift_begin'])!= (int)$v['man_shift_begin_min'] ||
    	(int) date("H",$tsRow['confirm_shift_end'])!= (int)$v['man_shift_end_hour'] ||
    	(int) date("i",$tsRow['confirm_shift_end'])!= (int)$v['man_shift_end_min']
    ){
    	
    	echo 'WRONG SHIFT<br />';
    }
    
    // 2. MISSING ATTN
    if( $attRow[0]=="" || $attRow[1]=="" 
    ){
    	echo 'MISSING RECORD<br />';
    }		
    
    ?>
    </td>
    <td rowspan="2"><?php echo $v['hour_request']?></td>
    <td rowspan="2"><?php echo $v['hour_allocate']?></td>
    <td rowspan="2"><?php echo $v['hour_request'] - $v['hour_allocate'] ?></td>
    <td>F:<?php echo ($v['link_image_open'])?'<a href="'.$v["link_image_open"].'" target="_blank">View</a>':' - ';?></td>
    <td>F:<?php echo ($v['link_image_close'])?'<a href="'.$v["link_image_close"].'" target="_blank">View</a>':' - ';?></td>
    <td rowspan="2" align="center">
    <?php
    $lastStatus = $attCaseRecord->lastStatus($v['id_case']);
	if($lastStatus['id_status'] == 1){ echo '<img src="/im/ind_new.png" border="0" />'; }
	?>
    </td>
    <td rowspan="2" align="center"><?php
    if($lastStatus['id_status'] == 4){ echo '<img src="/im/ind_req.png" border="0" />'; }
	?></td>
    <td rowspan="2" align="center">
    <?php
    if($lastStatus['id_status'] == 5){ echo '<img src="/im/ind_prv.png" border="0" />'; }
	?>
    </td>
    <td rowspan="2">[<a id="txt<?=$v["id_case"]?>" href="javascript:toggle('dT<?=$v["id_case"]?>','txt<?=$v["id_case"]?>');">Show</a>]</td>
    <td rowspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>
    <a id="go" rel="leanModal" name="request" href="#btn_req<?=$v["id_case"]?>">Request</a>
        <div id="btn_req<?=$v["id_case"]?>" class="btn_act">        
		<div style=" background-color:#97C0FF; display:block">
		<span style="float:left">Request more information</span> <span style="float:right;"><a class="modal_close" href="#">[ X ]</a></span><br />
		</div>
        <div style="background-color:#EEE; display:block"><br />

        <form action="/rosteraudit/save-request" method="post">
        Request more information regarding this case <br /><br />
		Input Head Office Staff Name:  <input name="staff_name" type="text" /> <br /><br />

        Reason/Comment For Request More Info:<br /> 
		<textarea name="comment" style="width:80%" rows="2"></textarea><br />

        <input type="hidden" name="id_case" value="<?=$v["id_case"]?>" />
		
        <input name="btn_request" type="submit" value="Send Request" />
        </form>
        <br />
        </div>
</div>
    </td>
    <td>
     <a id="go" rel="leanModal" name="request" href="#btn_acc<?=$v["id_case"]?>">Accept</a>
        <div id="btn_acc<?=$v["id_case"]?>" class="btn_edit">        
		<div style=" background-color:#97C0FF; display:block">
		<span style="float:left">ACCEPT</span> <span style="float:right;"><a class="modal_close" href="#">[ X ]</a></span><br />
		</div>
        <div style="background-color:#EEE; display:block; padding:"><br />

        <form action="/rosteraudit/save-accept" method="post">
        I have seen all the proofs and would Like to Accept The Case <br /><br />

		Input Head Office Staff Name: <input name="staff_name" type="text" /> <br /><br />
		
        I will process the payment on <input name="date_will_pay" type="text" id="date_will_pay" value="" /><br />
        Changes will be Be Allocated is :<br />
        <table width="800" border="1" cellspacing="0" cellpadding="2">
  <tr>
    <td rowspan="2">Roster Change</td>
    <td>ShiftBegin</td>
    <td>Shift End</td>
    <td>New Shift Begin</td>
    <td>New Shift End</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><?php echo date("H:i",$tsRow['confirm_shift_begin']) ?></td>
    <td><?php echo date("H:i",$tsRow['confirm_shift_end']) ?></td>
    <td><?php echo $v['man_shift_begin_hour']?> : <?php echo $v['man_shift_begin_min']?> </td>
    <td><?php echo $v['man_shift_end_hour']?> : <?php echo $v['man_shift_end_min']?> </td>
  	<td>&nbsp;</td>
  </tr>
  <tr>
    <td rowspan="2">Attn Record Change</td>
    <td>On Duty</td>
    <td>Off Duty</td>
    <td>New On Duty</td>
    <td >New Off Duty</td>
  	<td>&nbsp;</td>
  </tr>
  <tr>
    <td><?php echo ($attRow[0])?date("H:i",$attRow[0]):' X ' ?></td>
    <td><?php echo ($attRow[1])?date("H:i",$attRow[1]):' X ' ?></td>
    <td><?php echo $v['staff_shift_begin_hour']?> : <?php echo $v['staff_shift_begin_min']?> </td>
    <td><?php echo $v['staff_shift_end_hour']?> : <?php echo $v['staff_shift_end_min']?> </td>
  <td>&nbsp;</td>
  </tr>
  <tr>
    <td rowspan="2">Short Hours</td>
    <td>Normal Hours</td>
    <td>After 6PM</td>
    <td>Saturday Hours</td>
    <td>Sunday Hours</td>
    <td>Holiday Hours</td>
  </tr>
  <tr>
    <td><input name="normal_hour" id="normal_hour" type="text"  value="0" /> </td>
    <td><input name="pm6_hour" id="pm6_hour" type="text"  value="0" /> </td>
    <td><input name="saturday_hour" id="saturday_hour" type="text"  value="0" /></td>
    <td><input name="sunday_hour" id="sunday_hour" type="text"  value="0" /></td>
    <td><input name="holiday_hour" id="holiday_hour" type="text"  value="0" /></td>
  </tr>
</table>

Comment / Detail
<textarea name="comment" style="width:80%" rows="2"></textarea><br />
        <input type="hidden" name="id_case" value="<?=$v["id_case"]?>" />
		
        <input name="btn_activation" type="submit" value="Accept It!" />
        </form>
        <br />
        </div>
</div>
    
    
    </td>
    <td>
     <a id="go" rel="leanModal" name="request" href="#btn_rej<?=$v["id_case"]?>">Reject</a>
        <div id="btn_rej<?=$v["id_case"]?>" class="btn_com">        
		<div style=" background-color:#97C0FF; display:block">
		<span style="float:left">Rejection</span> <span style="float:right;"><a class="modal_close" href="#">[ X ]</a></span><br />
		</div>
        <div style="background-color:#EEE; display:block"><br />

        <form action="/rosteraudit/save-reject" method="post">
        The Evidence provided is not good enough For me to make "Accept Case" Decision. <br /><br />
		There will be no more proofs,payment will NOT be processed.<br />
<br />

		Input Head Office Staff Name: <input name="staff_name" type="text" /> <br /><br />
		Reason / Comment Of Reject Case
		<textarea name="comment" style="width:80%" rows="2"></textarea><br />

        <input type="hidden" name="id_case" value="<?=$v["id_case"]?>" />
		
        <input name="btn_rej" type="submit" value="Reject It!" />
        </form>
        <br />
        </div>
</div>
    
    </td>
  </tr>
</table>
</td>
  </tr>
  <tr>
    <td>IPT:</td>
    <td><?php echo str_pad($v['man_shift_begin_hour'],2,"0",STR_PAD_LEFT); ?> : <?php echo  str_pad($v['man_shift_begin_min'],2,"0",STR_PAD_LEFT); ?> </td>
    <td><?php echo str_pad($v['man_shift_end_hour'],2,"0",STR_PAD_LEFT);?> : <?php echo str_pad($v['man_shift_end_min'],2,"0",STR_PAD_LEFT);?> </td>
    <td><?php echo str_pad($v['staff_shift_begin_hour'],2,"0",STR_PAD_LEFT);?> : <?php echo str_pad($v['staff_shift_begin_min'],2,"0",STR_PAD_LEFT);?> </td>
    <td><?php echo str_pad($v['staff_shift_end_hour'],2,"0",STR_PAD_LEFT);?> : <?php echo str_pad($v['staff_shift_end_min'],2,"0",STR_PAD_LEFT);?> </td>
    <td>F:<?php echo $v['break_first_min']?> S: <?php echo $v['break_second_min']?> </td>
    <td>IN:<?php echo ($v['offline_inv_on'])?$v['offline_inv_on']:' - ';?></td>
    <td>IN:<?php echo ($v['offline_inv_off'])?$v['offline_inv_off']:' - ';?></td>
  </tr>
<tr>
<td colspan="22" style="padding:0px;">
<div id="dT<?=$v["id_case"]?>" style="display:none;" >

<h3>Reasons Why can Not Provide Footage:</h3>
<div>
<?php echo $v['reason_comment']?>
</div>
<h3>Detail Explainations:</h3>
<div>
<?php echo $v['detail_explain']?>
</div>
<h3>Comment &amp; Conversion</h3>

------------------------------------------------------------------------------------------
<hr/>
<?php 


$recordList = $attCaseRecord->getCaseHistory($v["id_case"]);
?>

<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-width: 0px;">
  <?php foreach($recordList as $v3) { ?>
  <tr>
    <td style="background-color:#EFEFEF; ">
    <span style="width:50px;display:inline-block;margin-left:10px;">
    <?php
    switch($v3["id_status"]){
    	case(1):{
    		echo '<img src="/im/ind_new.png" border="0" />';break;}
    	case(4):{
    		echo '<img src="/im/ind_req.png" border="0" />';break;
    	}
    	case(5):{
    		echo '<img src="/im/ind_prv.png" border="0" />';break;
    	}
    	case(9):{
    		echo '<img src="/im/com_sm.png" border="0" />[MR]';break;
    	}
		case(10):{
    		echo '<img src="/im/com_sm.png" border="0" />[ADM]';break;
    	}		
    	case(80):{
    		echo '<img src="/im/ind_acc.png" border="0" />';break;
    	}
    	case(90):{
    		echo '<img src="/im/ind_rej.png" border="0" />';break;
    	}
    }
    ?>
    </span> -- On 
    <?=$v3["date_change"]?> -- <?=$v3["time_change"]?> -- By --<?=$v3["staff_name"]?>
    </td>
  </tr>
  <tr style="background-color:#FEFEFE; ">
    <td style="padding-left:20px;"><?php if($v3["comment"]!= null){echo nl2br($v3["comment"]);}?></td>
  </tr>
  <?php if($v3["link_img_upload"]!= null) {?>
  <tr style="background-color:#FEFEFE; ">
    <td style="padding-left:20px;">Attachement : <a href="<?php echo $v3["link_img_upload"]; ?>" target="_blank" >Click Here </a></td>
  </tr> 
  <?php }}?>
  </table>
  
------------------------------------------------------------------------------------------------------
<hr />

<form id="form2" name="form2" method="post" action="/rosteraudit/save-add-comm-admin">
  <textarea name="comm_admin" id="comm_admin" rows="2" style="width:80%"></textarea>
  <br />
  <br />
  Staff Name: 
  <input type="text" name="staff_name_admin" id="staff_name_admin" /> 
  <input type="hidden" name="id_case" value="<?=$v["id_case"]?>" /> 
  <input name="btn_comment_admin" type="submit" value="Add Comment" />

</form>


</div>
</td>
</tr>  
<?php }} ?>  
  
  
</table>




<h2>Payment Pending Case</h2>
<table width="1300" border="0" cellspacing="0" cellpadding="0" style="font-size:12px;">
  <tr>
    <th scope="col" rowspan="2" align="center">Case ID</th>
    <th scope="col" rowspan="2" align="center">Shop</th>
    <th scope="col" rowspan="2" align="center">Manager</th>
    <th scope="col"  rowspan="2" align="center">Staff</th>
    <th scope="col" rowspan="2" align="center">Date</th>
    <th scope="col" rowspan="2" align="center">Allocated Hours</th>
    <th scope="col" rowspan="2" align="center">Paid Hours</th>
    <th scope="col" rowspan="2" align="center">Short Hours</th>
    <th colspan="5"  align="center" scope="col">PayHour Detail</th>
    <th scope="col"  rowspan="2" align="center">Pay Date</th>
    <th scope="col" rowspan="2" align="center">Action</th>
  </tr>
  <tr>
    <td align="center" style="width:50px">Normal</td>
    <td align="center" style="width:50px">Aft 6PM</td>
    <td align="center" style="width:50px">Sat</td>
    <td align="center" style="width:50px">Sun</td>
    <td align="center" style="width:50px">Holiday</td>
  </tr>
  
<?php
if(!empty($this->waitCase)){
foreach($this->waitCase as $v2){
?>  
  <tr>
    <td><?php echo $v2['case_id_case']?></td>
    <td><?php echo $v2['shop_code']?></td>
    <td><?php 
    $mgrDetail = $stDetail->getDetail($v2['id_manager']);
    echo ($mgrDetail['ni']=="")?Model_EncryptHelper::getSslpassword($mgrDetail['n']):$mgrDetail['ni'];
    ?></td>
    <td><?php 
    $mgrDetail = $stDetail->getDetail($v2['id_staff']);
    echo ($mgrDetail['ni']=="")?Model_EncryptHelper::getSslpassword($mgrDetail['n']):$mgrDetail['ni'];
    ?></td>
    <td><?php echo $v2['shift_date']?></td>
    <td><?php echo $v2['hour_request']?></td>
    <td><?php echo $v2['hour_allocate']?></td>
    <td><?php echo $v2['hour_request'] - $v2['hour_allocate'] ?></td>
    <td><?php echo $v2['hour_allocate_normal']?></td>
    <td><?php echo $v2['hour_allocate_6pm']?></td>
    <td><?php echo $v2['hour_allocate_sat']?></td>
    <td><?php echo $v2['hour_allocate_sun']?></td>
    <td><?php echo $v2['hour_allocate_pholiday']?></td>
    <td><?php echo $v2['pay_on']?></td>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td align="center">
        <a id="go" rel="leanModal" name="request" href="#btn_exp<?=$v2["id_case"]?>">Export</a>
        <div id="btn_exp<?=$v2["id_case"]?>" class="btn_com">        
		<div style=" background-color:#97C0FF; display:block">
		<span style="float:left">Export</span> <span style="float:right;"><a class="modal_close" href="#">[ X ]</a></span><br />
		</div>
        <div style="background-color:#EEE; display:block"><br />

        <form action="/rosteraudit/save-export" method="post">
        You are about to export the time sheet for this page, after you done this, we will consider this one is in Paid Condition
        <br />

		Input Head Office Staff Name: <input name="staff_name" type="text" /> <br /><br />
        <input type="hidden" name="id_case" value="<?=$v2["id_case"]?>" />
        <input name="btn_export" type="submit" value="Export Time Sheet" />
        </form>
        <br />
        </div>
</div>
        
        
        </td>
        <td align="center">
         <a id="go" rel="leanModal" name="request" href="#btn_delay<?=$v2["id_case"]?>">Delay</a>
        <div id="btn_delay<?=$v2["id_case"]?>" class="btn_com">        
		<div style=" background-color:#97C0FF; display:block">
		<span style="float:left">Delay Payment</span> <span style="float:right;"><a class="modal_close" href="#">[ X ]</a></span><br />
		</div>
        <div style="background-color:#EEE; display:block"><br />

        <form action="/rosteraudit/save-delay" method="post">
        I have reason to Delay This Payment to The following Date for the following Reason
        <br />

		Input Head Office Staff Name: <input name="staff_name" type="text" /> <br /><br />
        Delay To :<input name="date_will_pay" type="text" id="date_will_pay" value="" /><br />
<br />

		Reason / Delay The Payment
		<textarea name="comment" style="width:80%" rows="2"></textarea><br />

        <input type="hidden" name="id_case" value="<?=$v2["id_case"]?>" />
		
        <input name="btn_delay" type="submit" value="Delay Payment" />
        </form>
        <br />
        </div>
</div>
    
       
        </td>
        <td align="center">
         <a id="go" rel="leanModal" name="request" href="#btn_rej<?=$v2["id_case"]?>">Reject</a>
        <div id="btn_rej<?=$v2["id_case"]?>" class="btn_com">        
		<div style=" background-color:#97C0FF; display:block">
		<span style="float:left">Rejection</span> <span style="float:right;"><a class="modal_close" href="#">[ X ]</a></span><br />
		</div>
        <div style="background-color:#EEE; display:block"><br />

        <form action="/rosteraudit/save-reject" method="post">
        The Evidence provided is not good enough For me to make "Accept Case" Decision. <br /><br />
		There will be no more proofs,payment will NOT be processed.<br />
<br />

		Input Head Office Staff Name: <input name="staff_name" type="text" /> <br /><br />
		Reason / Comment Of Reject Case
		<textarea name="comment" style="width:80%" rows="2"></textarea><br />

        <input type="hidden" name="id_case" value="<?=$v2["id_case"]?>" />
		
        <input name="btn_rej" type="submit" value="Reject It!" />
        </form>
        <br />
        </div>
</div>
    
   
        
        
        </td>
      </tr>
    </table></td>
  </tr>
<?php }}?>
</table>
<p>Click <a href="/ACDF_Shortpayment<?php echo Model_DatetimeHelper::dateToday("");?>.txt" target="_blank">Here(AF)</a> / <a href="/BE_Shortpayment<?php echo Model_DatetimeHelper::dateToday("");?>.txt" target="_blank">Here(BE)</a> for Today's Exported Time Sheet, You should only do it &quot;ONCE A DAY&quot;</p>

<h2>Rejected/Canceled Case History</h2>

<table width="1300" border="0" cellspacing="0" cellpadding="0" style="font-size:12px;">
  <tr>
    <th scope="col" align="center">Case ID</th>
    <th scope="col" align="center">Shop</th>
    <th scope="col" align="center">Manager</th>
    <th scope="col" align="center">Staff</th>
    <th scope="col" align="center">Date</th>
    <th scope="col" align="center">Allocated Hours</th>
    <th scope="col" align="center">Paid Hours</th>
    <th scope="col" align="center">Short Hours</th>
    <th  align="center" scope="col">Reject Date</th>
    <th  align="center" scope="col">Reject Comment</th>
  </tr>
  <?php
  if(!empty($this->rejectCase)){
foreach($this->rejectCase as $v3){
?>
  <tr>
    <td><?php echo $v3['case_id_case']?></td>
    <td><?php echo $v3['shop_code']?></td>
    <td><?php 
    $mgrDetail = $stDetail->getDetail($v3['id_manager']);
    echo ($mgrDetail['ni']=="")?Model_EncryptHelper::getSslpassword($mgrDetail['n']):$mgrDetail['ni'];
    ?></td>
    <td><?php 
    $mgrDetail = $stDetail->getDetail($v3['id_staff']);
    echo ($mgrDetail['ni']=="")?Model_EncryptHelper::getSslpassword($mgrDetail['n']):$mgrDetail['ni'];
    ?></td>
    <td><?php echo $v3['shift_date']?></td>
    <td><?php echo $v3['hour_request']?></td>
    <td><?php echo $v3['hour_allocate']?></td>
    <td><?php echo $v3['hour_request'] - $v3['hour_allocate'] ?></td>
    <td><?php echo $v3['dicision_date']?></td>
    <td><?php 
	$comm = $attCaseRecord->rejectComment($v3['id_case']);
	
	echo $comm; 

	?></td>
  </tr>
  <?php }}?>
</table>
<h2>Closed Case History</h2>
<table width="1300" border="0" cellspacing="0" cellpadding="0" style="font-size:12px;">
  <tr>
    <th scope="col" rowspan="2" align="center">Case ID</th>
    <th scope="col" rowspan="2" align="center">Shop</th>
    <th scope="col" rowspan="2" align="center">Manager</th>
    <th scope="col"  rowspan="2" align="center">Staff</th>
    <th scope="col" rowspan="2" align="center">Date</th>
    <th scope="col" rowspan="2" align="center">Allocated Hours</th>
    <th scope="col" rowspan="2" align="center">Paid Hours</th>
    <th scope="col" rowspan="2" align="center">Short Hours</th>
    <th colspan="4"  align="center" scope="col">PayHour Detail</th>
    <th scope="col"  rowspan="2" align="center">Paid Date</th>
    <th scope="col"  rowspan="2" align="center">cheque No</th>
  </tr>
  <tr>
    <td align="center" style="width:50px">Normal</td>
    <td align="center" style="width:50px">Aft 6PM</td>
    <td align="center" style="width:50px">Sat</td>
    <td align="center" style="width:50px">Sun</td>
  </tr>
  <?php
  if(!empty($this->paidCase)){
foreach($this->paidCase as $v4){
?>
  <tr>
    <td><?php echo $v4['case_id_case']?></td>
    <td><?php echo $v4['shop_code']?></td>
    <td><?php 
    $mgrDetail = $stDetail->getDetail($v4['id_manager']);
    echo ($mgrDetail['ni']=="")?Model_EncryptHelper::getSslpassword($mgrDetail['n']):$mgrDetail['ni'];
    ?></td>
    <td><?php 
    $mgrDetail = $stDetail->getDetail($v4['id_staff']);
    echo ($mgrDetail['ni']=="")?Model_EncryptHelper::getSslpassword($mgrDetail['n']):$mgrDetail['ni'];
    ?></td>
    <td><?php echo $v4['shift_date']?></td>
    <td><?php echo $v4['hour_request']?></td>
    <td><?php echo $v4['hour_allocate']?></td>
    <td><?php echo $v4['hour_request'] - $v4['hour_allocate'] ?></td>
    <td><?php echo $v4['hour_allocate_normal']?></td>
    <td><?php echo $v4['hour_allocate_6pm']?></td>
    <td><?php echo $v4['hour_allocate_sat']?></td>
    <td><?php echo $v4['hour_allocate_sun']?></td>
    <td><?php echo $v4['pay_on']?></td>
    <td>
    <?php 
	if($v4['cheque_no']!=""){
		echo $v4['cheque_no'];
		}
	else{
	?>	
	<a id="go" rel="leanModal" name="request" href="#btn_cheq<?=$v4["id_case"]?>">Upload Cheque No</a>
        <div id="btn_cheq<?=$v4["id_case"]?>" class="btn_com">        
		<div style=" background-color:#97C0FF; display:block">
		<span style="float:left">Upload Cheque No</span> <span style="float:right;"><a class="modal_close" href="#">[ X ]</a></span><br />
		</div>
        <div style="background-color:#EEE; display:block"><br />

        <form action="/rosteraudit/save-cheque" method="post">
        You are about to upload the cheque no from MYOB, This is the Final Step, After Cheque No Upload, Case is Closed and will disappear in the list in 30 days
        <br />

		Input Head Office Staff Name: <input name="staff_name" type="text" /> <br /><br />
        Cheque No in Myob: <input name="cheque_no" type="text" />
        <input type="hidden" name="id_case" value="<?=$v4["id_case"]?>" />
        <input name="btn_che" type="submit" value="Record Cheque No" />
        </form>
        <br />
        </div>
</div>
    
    <?php	
	}	
	?>
    </td>
  </tr>
  <?php }}?>
</table>
<br/>
<div id = "payrollWizard" <?php if(!$this->nextCheck){?>style = "visibility:hidden;<?php }?>">
<input type = "submit" name = "next" id = "next" value = "Next" onclick="window.open('http://192.168.1.124/rosteraudit/export-time-sheet')"></input>
</div>
<script language="javascript" >

$(document).ready(function() {
	
	$('input[id^="cald"]').change(function(){
		
	var startHour =  parseFloat($("#cald_start_hour").val()); 
	var startMin =  parseFloat($("#cald_start_min").val());
	var endHour =  parseFloat($("#cald_end_hour").val());
	var	endMin =  parseFloat($("#cald_end_min").val());
	var totalHour = 0;
	totalHour = Math.round(((endHour - startHour) + (endMin-startMin)/60 ) * 100 )/100;
	$("#calh_total_hour").val(totalHour.toFixed(2));		
		});
	$('input[id^="calh"]').change(function(){
		var hour1 = parseFloat($("#calh_total_hour").val());
		var hour2 = parseFloat($("#calh_hour_2").val());
		var sumHour = 0;
		sumHour = hour1 + hour2;
		//alert(sumHour);
		$("#calh_hour_sum").val(sumHour.toFixed(2));
		});	
		
		
});
  </script>
</body>
</html>
